<style>
#debt_report_dugovanja form{
}
#debt_report_dugovanja input[type=submit]{
	float:right;
}
#debt_report_dugovanja form select{
	width:170px;
}
#debt_report_dugovanja h1.report{
	padding-left:24px;
}
#debt_report_dugovanja fieldset{
	float:left;
}
#debt_report_dugovanja_result{
	margin:2px 2px 0px 0px;
}
#debt_report_dugovanja_result table tr.head:hover{
	background:{{$highlight}};
	color:{{$highlighttext}};
}
#debt_report_dugovanja_result table tr:hover{
	background:#ccc;
}
#debt_report_dugovanja_result table tr td .complete_plan{
	width:150px;
	display:none;
	position:absolute;
	background:#fff;
	border:1px solid #333;
	padding:0px;
	font-size:11px;
	margin:0px 0px 0px -100px;
}
#debt_report_dugovanja_result table tr td:hover .complete_plan{
	display:block;
}
#debt_report_dugovanja_result table tr td .complete_plan table{
	width:100%;
}
#debt_report_dugovanja_result table tr td .complete_plan table tr td:last-child{
	text-align:right;
}
#debt_report_dugovanja_result table tr.sum{
	font-weight:bolder;
}
#debt_report_dugovanja_result table tr.border td{
	padding:0px;
	height:2px;
	font-size:2px;
	overflow:hidden;
	background:#333;
}
</style>
<div class="area" id="debt_report_dugovanja">
	<h1 class="report">Dugovanja</h1>
	<form method="post" action="javascript:void(0)" onsubmit="submitForm(this,'ugovori.php','POST','setContent');">
	
		<input type="hidden" name="a" value="real_report" />
		<input type="hidden" name="mod" value="debt" />
		<input type="hidden" name="rep" value="dugovanja" />
		
		<fieldset>
		<legend>datum ugovora</legend>
			<label class="left" for="filter_ugovor_od">od:</label>
		<input type="text" name="filter_ugovor_od" id="filter_ugovor_od" class="dateInput" value="{{$filter_ugovor_od}}" />
		<input type="button" class="datePicker" onclick="displayDatePicker('filter_ugovor_od',this)" />
			
			<label class="left" for="filter_ugovor_do">do:</label>
		<input type="text" name="filter_ugovor_do" id="filter_ugovor_do" class="dateInput" value="{{$filter_ugovor_do}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_ugovor_do',this)" />
		</fieldset>
		
		<fieldset>
			<legend>datum plana otplate</legend>
			<label class="left" for="filter_plan_od">od:</label>
			<input type="text" name="filter_plan_od" id="filter_plan_od" class="dateInput" value="{{$filter_plan_od}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_plan_od',this)" />
			
			<label class="left" for="filter_plan_do">do:</label>
			<input type="text" name="filter_plan_do" id="filter_plan_do" class="dateInput" value="{{$filter_plan_do}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_plan_do',this)" />
		</fieldset>
		<fieldset style="float:none">
			<legend>pozivaoci</legend>
			<fieldset id="pozivanje_ugovori">
<!--				<style>
					#pozivanje_ugovori input[type=checkbox] {
						clear:left;
					}
					#pozivanje_ugovori label {
						float:none;display:inline;
					}
				</style>-->
				<legend>ugovori</legend>
				<div>
					<input type="radio" name="filter_ugovori_pozivanje" {{$checked_pozivanje_radio1}} value="1" id="filter_ugovori_pozivanje1" />
					<label for="filter_ugovori_pozivanje1">dodeljeni</label>
					<br clear="all">
					<input type="radio" name="filter_ugovori_pozivanje" {{$checked_pozivanje_radio2}} value="2" id="filter_ugovori_pozivanje2" />
					<label for="filter_ugovori_pozivanje2">nedodeljeni</label>
					<br clear="all">
					<input type="radio" name="filter_ugovori_pozivanje" {{$checked_pozivanje_radio3}} value="3" id="filter_ugovori_pozivanje3" />
					<label for="filter_ugovori_pozivanje3">svi</label>
				</div>
			</fieldset>
			<fieldset>
				<legend>pozivalac</legend>
				<select style="width:50mm;" name="filter_pozivalac" id="filter_pozivalac">
					<option value="-1">-----</option>
					{{%loop start filter_pozivaoci_user_ids}}
					<option value="{{$filter_pozivaoci_user_ids}}" {{$filter_pozivaoci_selected}}>{{$filter_pozivaoci_users}}</option>
					{{%loop end}}
				</select>
			</fieldset>
		</fieldset>
		
		<br clear="all" />
		<label class="left" for="filter_tip_ugovora">Tip ugovora:</label>
		<select name="filter_tip_ugovora" id="filter_tip_ugovora">
			<option value="-1">-----</option>
			{{%loop start filter_ugovori_tipovi_ids}}
			<option value="{{$filter_ugovori_tipovi_ids}}" {{$selected_filter_ugovor_tip}}>{{$filter_ugovori_tipovi}}</option>
			{{%loop end}}
		</select>

		<label for="filter_kampanja" class="left">Kampanja:</label>
		<select name="filter_kampanja" id="filter_kampanja">
			<option value="-1">---</option>
			{{%loop start kampanja_id}}
			<option value="{{$kampanja_id}}" {{$selected_filter_kampanja}}>{{$kampanja_name}}</option>
			{{%loop end}}
		</select>
		<br clear="all"/>
		<label class="left" for="filter_radnik">Komercijalista:</label>
		<select name="filter_radnik" id="filter_radnik">
			<option value="-1">---</option>
			{{%loop start filter_radnik_id}}
			<option value="{{$filter_radnik_id}}" {{$filter_radnik_selected}}>{{$filter_radnik_ime}}&nbsp;{{$filter_radnik_prezime}}</option>
			{{%loop end}}
		</select>
		
		<label class="left" for="filter_delatnost">Delatnost:</label>
		<select name="filter_delatnost" id="filter_delatnost">
			<option value="-1">---</option>
			{{%loop start filter_delatnost_id}}
			<option value="{{$filter_delatnost_id}}" {{$filter_delatnost_selected}}>{{$filter_delatnost_name}}</option>
			{{%loop end}}
		</select>
		<input type="submit" value="Kreiraj" />
	</form>
</div><br clear="all" />
<div id="debt_report_dugovanja_result" class="area_white" style="display:{{$display_result}}">
	<div id="divRadnici" style="display:none">
		<select style="width:100%" id="radnici" onblur="onComboRadniciBlur(event);" onclick="event.stopPropagation();" onchange="javascript:onComboRadniciChange(event);">
			<option value="-1">-----</option>
			{{%loop start users_id}}
			<option value="{{$users_id}}">{{$radnici_svi}}</option>
			{{%loop end}}
		</select>
	</div>
	{{$comment_start}}
	<input type="button" class="excel" onclick="exportCSV(document.getElementById('ResultTable').innerHTML.replace(/<div class=&quot;complete_plan&quot;>.*?<\/div>/g,''))" value="preuzmi" />
	<p class="info">{{$info}}</p>
	<table id="ResultTable">
		<tr class="head" align="center">
			<td colspan="4">komitent</td>
			<td colspan="8">ugovor</td>
			<td>pozivanje</td>
		</tr>
		<tr class="head" align="center">
			<td>šifra</td>
			<td>naziv</td>
			<td>telefon</td>
			<td>kontakti</td>
			<td>komercijalista</td>
			<td>broj</td>
			<td>tip</td>
			<td>vrednost</td>
			<td>uplaćeno</td>
			<td>duguje</td>
			<td>datum</td>
			<td title="poslednja rata">plan otplate</td>
			<td>pozivalac</td>
		</tr>
		{{%loop start komid}}
		<tr>
			<td>{{$komid}}</td>
			<td>{{$komname}}</td>
			<td align="center">
				<img src="gui/icons/phone.gif" onclick="alert(this.nextSibling.nextSibling.innerHTML)" />
				<div style="display:none">{{$komphone}}</div>
			</td>
			<td align="center">
				<img src="gui/icons/users.gif" onclick="alert(this.nextSibling.nextSibling.innerHTML)" />
				<div style="display:none">{{$komcontacts}}</div>
			</td>
			<td>{{$radnik_ime}}&nbsp;{{$radnik_prezime}}</td>
			<td>{{$ugobroj}}</td>
			<td>{{$ugovor_tip}}</td>
			<td align="right">{{$ugoiznos}}</td>
			<td align="right">{{$ugootplata}}</td>
			<td align="right">{{$ugodug}}</td>
			<td>{{$ugodate}}</td>
			<td>
				<div class="complete_plan">
					{{$ugoplan}}
				</div>
				{{$ugoplan_last}}
			</td>
			<td ugovor="{{$ugovori_ids}}" pozivalac_user_id="{{$pozivalac_user_id}}" width="120mm" onclick="onCellPozivalacClick(event);">{{$pozivalac}}</td>
		</tr>
		{{%loop end}}
		<tr class="border">
			<td colspan="11">&nbsp;</td>
		</tr>
		{{%loop start radnik_sum}}
		<tr class="sum">
			<td colspan="4">&nbsp;</td>
			<td colspan="2">{{$radnik_ime_sum}}&nbsp;{{$radnik_prezime_sum}}</td>
			<td align="right">{{$vrednost_sum}}</td>
			<td align="right">{{$uplaceno_sum}}</td>
			<td align="right">{{$duguje_sum}}</td>
			<td colspan="2">&nbsp;</td>
		</tr>
		{{%loop end}}
		<tr class="sum">
			<td colspan="4">&nbsp;</td>
			<td colspan="2" align="right">UKUPNO:</td>
			<td align="right">{{$sum_vrednost}}</td>
			<td align="right">{{$sum_uplaceno}}</td>
			<td align="right">{{$sum_duguje}}</td>
			<td colspan="2">&nbsp;</td>
		</tr>
	</table>
	{{$comment_end}}
</div>